import request from "../index";

//管理员登录
export const reqAdminLogin = ({fd}) => request({
    url: '/admin/adminLogin',
    method: 'POST',
    data:{
        fd
    }
})

//后台管理系统
//获取文章分类信息的接口
export const reqGetArticleSort = () => request({
    url: '/admin/article-sort/getSort',
    method: 'GET',
})

//修改文章分类的接口
export const reqUpdateArticleSort = ({id, oldSort, newSort}) => request({
    url: '/admin/article-sort/updateSort',
    method: 'POST',
    data: {
        id,
        oldSort,
        newSort
    }
})

//获取文章列表信息的接口
export const reqGetArticleList = () => request({
    url: '/admin/article-list/getArticleList',
    method: 'GET',
})

//修改文章信息的接口
export const reqUpdateArticle = ({article_id, articleInfo}) => request({
    url: '/admin/article-list/updateArticle',
    method: 'POST',
    data: {
        article_id, articleInfo
    }
})

//根据文章id删除的接口
export const reqDeleteArticleById = (id) => request({
    url: `/admin/article-list/deleteArticleById/${id}`,
    method: 'GET',
    data: {
        id
    }
})

//批量删除文章列表的接口
export const reqDeleteArticleList = (articleIds) => request({
    url: '/admin/article-list/deleteArticleList',
    method: 'POST',
    data: {
        articleIds
    }
})

//获取用户列表信息的接口
export const reqGetUserList = () => request({
    url: '/admin/user-table/getUserList',
    method: 'GET',
})

//添加用户列表信息的接口
export const reqAddUserList = (fd) => request({
    url: '/admin/user-table/addNewUser',
    method: 'POST',
    data: {
        fd
    }
})

//修改用户信息的接口
export const reqUpdateUser = ({user_id, fd}) => request({
    url: '/admin/user-table/updateUser',
    method: 'POST',
    data: {
        user_id, fd
    }
})

//删除用户的接口
export const reqDeleteUser = ({user_id}) => request({
    url: '/admin/user-table/deleteUser',
    method: 'GET',
    params: {
        user_id
    }
})
//批量删除用户列表信息的接口
export const reqDeleteUserList = (userIds) => request({
    url: '/admin/user-table/deleteUsers',
    method: 'POST',
    data: {
        userIds
    }
})

//添加课程的接口
export const reqAddNewCourse = ({fd}) => request({
    url: '/admin/course-page/addNewCourse',
    method: 'POST',
    data: {
        fd
    }
})
//修改课程的接口
export const reqEditCourse = ({course_id, fd}) => request({
    url: '/admin/course-page/editCourse',
    method: 'POST',
    data: {
        course_id, fd
    }
})

//根据id删除课程信息
export const reqDeleteCourseById = (id) => request({
    url: `admin/course-page/deleteCourseById/${id}`,
    method: 'GET',
    params: {
        id
    }
})


//获取课程信息的接口
export const reqGetCourseList = () => request({
    url: '/admin/course-page/getCourseList',
    method: 'GET',
})

//获取课程订单的接口
export const reqGetCourseOrderList = () => request({
    url: '/admin/course-order/getCourseOrderList',
    method: 'GET',
})

//删除课程订单的接口
export const reqDeleteCourseOrderById = ({order_id}) => request({
    url: '/admin/course-order/deleteCourseOrderById',
    method: 'GET',
    params:{
        order_id
    }
})

//获取活动信息的接口
export const reqGetActivityList = () => request({
    url: '/admin/activity-page/getActivityList',
    method: 'GET',
})

//添加活动信息的接口
export const reqAddActivity = ({fd}) => request({
    url: '/admin/activity-page/addActivity',
    method: 'POST',
    data: {
        fd
    }
})

//添加活动信息的接口
export const reqUpdateActivity = ({activity_id, fd}) => request({
    url: '/admin/activity-page/updateActivity',
    method: 'POST',
    data: {
        activity_id, fd
    }
})

//删除活动信息的接口
export const reqDeleteActivity = ({activity_id}) => request({
    url: '/admin/activity-page/deleteActivity',
    method: 'GET',
    params: {
        activity_id
    }
})


//获取商品信息的接口
export const reqGetShopList = () => request({
    url: '/admin/shop-page/getShopList',
    method: 'GET',
})

//添加商品信息的接口
export const reqAddShop = ({fd}) => request({
    url: '/admin/shop-page/addNewShop',
    method: 'POST',
    data: {
        fd
    }
})

//修改商品信息的接口
export const reqUpdateShop = ({shop_id, fd}) => request({
    url: '/admin/shop-page/updateShop',
    method: 'POST',
    data: {
        shop_id, fd
    }
})
//删除商品的接口
export const reqDeleteShop = ({shop_id}) => request({
    url: '/admin/shop-page/deleteShop',
    method: 'GET',
    params: {
        shop_id
    }
})

//获取权限列表的接口
export const reqGetRoleList = () => request({
    url: '/admin/role-manage/getRoleList',
    method: 'GET',
})





